package com.service.impl;

import com.dao.ChartsDao;
import com.service.ChartsService;
import com.vo.PieChartsEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author mornd
 * @date 2020/12/7 - 14:08
 */
@Service
@Transactional
public class ChartsServiceImpl implements ChartsService {
    @Autowired
    private ChartsDao chartsDao;
    /**
     * 查询每个年度总营业额
     *
     * @return
     */
    @Override
    public List<Map> getTotalPriceByYear() {
        return chartsDao.getTotalPriceByYear();
    }

    /**
     * 根据指定的年份统计每个月的营业额
     *
     * @param year
     * @return
     */
    @Override
    public List<Double> getTotalPriceByYearOfMonth(String year) {
        return chartsDao.getTotalPriceByYearOfMonth(year);
    }

    /**
     * 根据指定的年份统计该年份下每个季度的营业额
     *
     * @param year
     * @return
     */
    @Override
    public List<Map> getQuarterTotalPriceByYear(String year) {
        return chartsDao.getQuarterTotalPriceByYear(year);
    }

    /**
     * 根据年份和月份查询房间类型总数量
     *
     * @param selectDate
     * @return
     */
    @Override
    public List<PieChartsEntity> getRoomTypeCountByYearAndMonth(String selectDate) {
        return chartsDao.getRoomTypeCountByYearAndMonth(selectDate);
    }

    /**
     * 查询当天入住的记录
     *
     * @param selectDate
     * @return
     */
    @Override
    public List<PieChartsEntity> getCurrentCheckinCharts(String selectDate) {
        return chartsDao.getCurrentCheckinCharts(selectDate);
    }
}
